package com.atguigu.myJunit5;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;

// junit4 用RunWith和@ContextConfiguration
// 下面两行效果等于第三行
@ExtendWith(SpringExtension.class)
@ContextConfiguration("classpath:bean.xml")
//@SpringJUnitConfig(locations = "classpath:bean.xml") // 目的是为了代替ApplicationContext
public class SpringTestJunit5 {
    @Autowired
    private User user;

    @Test
    public void testUser() {
        System.out.println(user);
        user.run();
    }
}
